package com.ruoyi.pims.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.pims.mapper.PurchaseExecutionMapper;
import com.ruoyi.pims.domain.PurchaseExecution;
import com.ruoyi.pims.service.IPurchaseExecutionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 采购执行记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-17
 */
@Service
public class PurchaseExecutionServiceImpl implements IPurchaseExecutionService 
{
    @Autowired
    private PurchaseExecutionMapper purchaseExecutionMapper;

    /**
     * 查询采购执行记录
     * 
     * @param executionId 采购执行记录主键
     * @return 采购执行记录
     */
    @Override
    public PurchaseExecution selectPurchaseExecutionByExecutionId(Long executionId)
    {
        return purchaseExecutionMapper.selectPurchaseExecutionByExecutionId(executionId);
    }

    /**
     * 查询采购执行记录列表
     * 
     * @param purchaseExecution 采购执行记录
     * @return 采购执行记录
     */
    @Override
    public List<PurchaseExecution> selectPurchaseExecutionList(PurchaseExecution purchaseExecution)
    {
        return purchaseExecutionMapper.selectPurchaseExecutionList(purchaseExecution);
    }

    /**
     * 新增采购执行记录
     * 
     * @param purchaseExecution 采购执行记录
     * @return 结果
     */
    @Override
    public int insertPurchaseExecution(PurchaseExecution purchaseExecution)
    {
        purchaseExecution.setCreateTime(DateUtils.getNowDate());
        return purchaseExecutionMapper.insertPurchaseExecution(purchaseExecution);
    }

    /**
     * 修改采购执行记录
     * 
     * @param purchaseExecution 采购执行记录
     * @return 结果
     */
    @Override
    public int updatePurchaseExecution(PurchaseExecution purchaseExecution)
    {
        return purchaseExecutionMapper.updatePurchaseExecution(purchaseExecution);
    }

    /**
     * 批量删除采购执行记录
     * 
     * @param executionIds 需要删除的采购执行记录主键
     * @return 结果
     */
    @Override
    public int deletePurchaseExecutionByExecutionIds(String executionIds)
    {
        return purchaseExecutionMapper.deletePurchaseExecutionByExecutionIds(Convert.toStrArray(executionIds));
    }

    /**
     * 删除采购执行记录信息
     * 
     * @param executionId 采购执行记录主键
     * @return 结果
     */
    @Override
    public int deletePurchaseExecutionByExecutionId(Long executionId)
    {
        return purchaseExecutionMapper.deletePurchaseExecutionByExecutionId(executionId);
    }
}
